﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Finance.Bll;
using Finance.IBll;
using Finance.UI.Controllers;
using Finance.Entity;

namespace Finance.UI.Areas.FinanceManager.Controllers
{
    /// <summary>
    /// 账单类别
    /// </summary>
    public class BillTypeController : AreaBaseController
    {
        //
        // GET: /FinanceManager/BillType/
        IBillTypeBll billTypeBll = new BillTypeBll();
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Save(int id, string name, int isOut)
        {
            bool success = billTypeBll.Save(id, name, isOut);
            return Json(new { success = true });
        }

        public ActionResult List(string name, int? isOut = null, int pageIndex = 1, int pageSize = 20)
        {
            int total = 0;
            IEnumerable<AccountsTypeEntity> data = billTypeBll.List(name, isOut, pageIndex, pageSize, out total);
            return Json(new { success = true, data, total });
        }

        public ActionResult Delete(int id)
        {
            bool success = billTypeBll.Delete(id);
            return Json(new { success });
        }

    }
}
